public class Num1742 {
    public int countBalls(int lowLimit, int highLimit) {
        int[] arr = new int[46];
        int n = highLimit - lowLimit + 1;
        for (int i = lowLimit; i <= highLimit; i++) {
            int sum = 0;
            int num = i;
            while (num > 0) {
                sum += num % 10;
                num /= 10;
            }
            arr[sum]++;
        }
        int max = 0;
        for (int i = 0; i < 46; i++) {
            if (arr[i] == 0) continue;
            max = Math.max(max,arr[i]);
        }
        return max;
    }
}
